package personal.wang.constant;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.Inet4Address;
import java.net.UnknownHostException;

/**
 * 防止的硬编码，将常量设置在此类中
 * */
public class AppConstant {
    public static final Logger logger = LoggerFactory.getLogger(AppConstant.class);
    public static final String PARTITION_VALUE_DEFAULT = "default" ;

    public static final String TASK_NAME = "task_name" ;

    public static final String CONFIG_TYPE = "configType";

    public static final String CLUSTER_ENV_CONFIG = "clusterEnvConfig";

    public static final String TASK_LOGIC_CONFIG = "taskLogicConfig" ;

    public static final String TASK_RUN_CONFIG = "taskRunConfig" ;

    public static final String ES_CONFIG = "esConfig";

    public static final String CONSUMER_FROM_LAST = "consumerFromLast";

    public static final String CONSUMER_TIMESTAMP = "consumerTimestamp";

    public static final String NO_OUTPUT_STATE = "noOutput" ;

    public static final String YAML_FILE_EXTENSION = ".yaml" ;

    public static final String DIRECTORY_TASK_CONFIG_FILE = "task_config";

    public static final String APP_CONFIG_FILE_NAME = "application.yaml" ;

    public static final String COMMA = "," ;

    public static final String DOT = "." ;

    public static final String FALSE= Boolean.FALSE.toString() ;

    public static final String KAFKA_SINK = "kafka" ;

    public static final String JDBC_SINK = "jdbc" ;

    public static final String hdfs_sink = "hdfs" ;

    public static final String OP_UPDATE = "update" ;
    public static final String OP_INSERT = "insert" ;
    public static final String OP_DELETE = "delete" ;


    public static final String MER_DESC_SEPERATOR = "-" ;
    public static final String LOG_TRANS_CODE = "transCode" ;
    public static final String LOG_GLOBAL_BUSINESSCODE = "globalBusinessTraceCode" ;
    public static final String log_child_transcode = "childTransCode" ;
    public static final String log_custom_msg = "customMsg" ;

    public static final String DATSRC_CD = "2" ;

    public static final String GLOBAL_BUSI_TRACK_NO = "global_trace_no" ;

    public static final String NEW_VALUE_TAG = "NEW_VALUE";
    public static final String OLD_VALUE_TAG = "OLD_VALUE";
    public static final String OPTIMISTIC_VERSION_NO_FIELD_NAME = "optimistic_version_no";
    public static final String TABLE_NAME_PATH = "etl.source.kafka.table_name";
    public static final String SINK_TOPIC_NAME = "sinkTopicName";
    public static final String SINK_PARTITION_FIELD = "sinkPartitionFields" ;
    public static final String UNDERLINE = "_";
    public static final int SOURCE_PARALLELISM = 1;


    public static final String QUERY_REPLAY_COUNT_FIELD = "replay_count_flag";
    public static final String CHNL_TYPE_NO_FIELD_NAME = "chnl_type_no";
    public static final String DOT_SPLIT_REGEX = "\\s*,\\s*";
    public static final String COMPENSATION_TIMES_FLAG = "compensation_times";
    public static final String INCM_EPN_FLAG_CD = "incmEpnFlagCd";
    public static String IP ;
    static{
        try {
            IP = Inet4Address.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            logger.error("{}" , e);
        }
    }
}
